<template>
  <div class="event1-container">
    <h3>Event 1</h3>
    <el-button type="primary" @click="emitEvent1">按钮</el-button>
  </div>
</template>

<script setup lang="ts">
// 使用defineEmits定义事件
const emit = defineEmits(["custom-event"]);
const emitEvent1 = () => {
  console.log("emitEvent1");
  // 由于vue3中没有this，不能像vue2一样使用this.$emit("event1")
  emit("custom-event", "Event1传来的数据");
};
</script>

<style scoped>
.event1-container {
  background-color: yellow;
}
</style>
